import { defineStore } from 'pinia'

/**
 * 存储登录状态的处理
 */
export const useLoginStore = defineStore('loginStore', {
  state: () => {
    return {
      authorization: ''
    }
  },
  actions: {
    /**
     * 更新登陆凭证
     */
    setToken(value: string) {
      this.authorization = value
    },
    /**
     * 检测当前是否已经登陆
     */
    isLogined(): boolean {
      return this.authorization ? true : false
    }
  },
  persist: true
})
